﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:Microsoft.FamilyShow" 
    xmlns:tk="http://schemas.microsoft.com/wpf/2008/toolkit"
    x:Class="Microsoft.FamilyShow.FamilyData" 
    xmlns:properties="clr-namespace:Microsoft.FamilyShow.Properties"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d">

    <UserControl.Resources>

        <!-- used when editing a date cell -->
        <local:DateFormattingConverter x:Key="DateFormattingConverter"/>

        <!-- Converter for making readonly textboxes -->
        <local:BoolConverter x:Key="BoolConverter"/>

        <!-- Converter for making readonly textboxes -->
        <local:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>

        <!-- Converter for disabling the death related textboxes -->
        <local:NotConverter x:Key="NotConverter"/>

        <!-- Converter for displaying images -->
        <local:ImageConverter x:Key="ImageConverter"/>

        <!-- style for all cells when in edit mode -->
        <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}" >
            <Setter Property="ContextMenu" Value="{x:Null}"/>
            <Setter Property="Background" Value="#00ffffff" />
            <Setter Property="BorderBrush" Value="#00ffffff" />
            <Setter Property="AcceptsReturn" Value="False" />
            <Setter Property="AcceptsTab" Value="False" />
            <Setter Property="Foreground" Value="{DynamicResource FamilyDataFontColor}" />
            <Style.Triggers>
                <Trigger Property="IsFocused" Value="True">
                    <Setter Property="Foreground" Value="#ff000000" />
                    <Setter Property="BorderBrush" Value="#ff000000" />
                    <Setter Property="Background" Value="#a0ffffff" />
                </Trigger>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="OverridesDefaultStyle" Value="True"/>
                </Trigger>
            </Style.Triggers>
        </Style>

        <!-- style for read-only cells (age) -->
        <Style x:Key="AgeTextBlockStyle" TargetType="{x:Type TextBlock}" >
            <Setter Property="Background" Value="#00ffffff" />
            <Setter Property="Foreground" Value="{DynamicResource FamilyDataFontColor}"/>
        </Style>

        <!-- column header grip style -->
        <Style x:Key="ColumnGrip" TargetType="{x:Type Thumb}">
            <Setter Property="HorizontalAlignment" Value="Right" />
            <Setter Property="Width" Value="3" />
            <Setter Property="Opacity" Value="0.25" />
            <Setter Property="DockPanel.Dock" Value="Right" />
        </Style>

        <!-- templates that are used to display the cells in the columns -->

        <!-- first, empty column -->
        <DataTemplate x:Key="EmptyColumnTemplate"/>

        <!-- images column -->
        <DataTemplate x:Key="ImagesColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="1,1,1,1" x:Name="AvatarPhotoBorder">
                <Image x:Name="Avatar" Source="{Binding Path=Avatar, Converter={StaticResource ImageConverter}, Mode=OneWay }" Stretch="Uniform" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- has restriction column -->
        <DataTemplate x:Key="RestrictionColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="0,0,0,0" x:Name="RestrictionPhotoBorder">
                <Image x:Name="Restriction"  MinWidth="12" MaxWidth="12" Width="12"  Height="12" Visibility="{Binding Path=HasRestriction, Converter={StaticResource BoolToVisibilityConverter} , Mode=Default}"  Source="..\..\Images\SecurityLock.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- has sources column -->
        <DataTemplate x:Key="SourcesColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="0,0,0,0" x:Name="SourcesPhotoBorder">
                <Image x:Name="Source"  MinWidth="12" MaxWidth="12" Width="12"  Height="12" Visibility="{Binding Path=HasCitations, Converter={StaticResource BoolToVisibilityConverter} , Mode=Default}"  Source="..\..\Images\Citation.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- has notes column -->
        <DataTemplate x:Key="NotesColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="0,0,0,0" x:Name="NotesPhotoBorder">
                <Image x:Name="Note"  MinWidth="12" MaxWidth="12" Width="12"  Height="12" Visibility="{Binding Path=HasNote, Converter={StaticResource BoolToVisibilityConverter} , Mode=Default}"  Source="..\..\Images\Note.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- has photos column -->
        <DataTemplate x:Key="PhotosColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="0,0,0,0" x:Name="PhotosPhotoBorder">
                <Image x:Name="Photo"  MinWidth="12" MaxWidth="12" Width="12"  Height="12" Visibility="{Binding Path=HasPhoto, Converter={StaticResource BoolToVisibilityConverter} , Mode=Default}"  Source="..\..\Images\Photo.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- has notes column -->
        <DataTemplate x:Key="AttachmentsColumnTemplate">
            <Border HorizontalAlignment="Center" Margin="0,1,0,1" VerticalAlignment="Top" BorderThickness="0,0,0,0" x:Name="AttachmentsPhotoBorder">
                <Image x:Name="Attachment"  MinWidth="12" MaxWidth="12" Width="12"  Height="12" Visibility="{Binding Path=HasAttachments, Converter={StaticResource BoolToVisibilityConverter} , Mode=Default}"  Source="..\..\Images\Paperclip.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Center"/>
            </Border>
        </DataTemplate>

        <!-- names column -->
        <DataTemplate x:Key="NamesColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=FirstName}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- surname column -->
        <DataTemplate x:Key="SurnameColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=LastName}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- occupation column -->
        <DataTemplate x:Key="OccupationColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" AcceptsReturn="True" ToolTip="{Binding Path=Occupation}" MaxHeight="22" Text="{Binding Path=Occupation}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- suffix column -->
        <DataTemplate x:Key="SuffixColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=Suffix}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- age column -->
        <DataTemplate x:Key="AgeColumnTemplate">
            <TextBlock Style="{StaticResource AgeTextBlockStyle}" Text="{Binding Path=Age}"/>
        </DataTemplate>

        <!-- birth date column -->
        <DataTemplate x:Key="BirthDateColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}"
        Text="{Binding Path=BirthDate, Converter={StaticResource DateFormattingConverter}}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- birth place column -->
        <DataTemplate x:Key="BirthPlaceColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=BirthPlace}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- death date column -->
        <DataTemplate x:Key="DeathDateColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}"
  			Text="{Binding Path=DeathDate, Converter={StaticResource DateFormattingConverter}}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- death place column -->
        <DataTemplate x:Key="DeathPlaceColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=DeathPlace}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- burial place column -->
        <DataTemplate x:Key="BurialPlaceColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=BurialPlace}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- cremation place column -->
        <DataTemplate x:Key="CremationPlaceColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=CremationPlace}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- burial date column -->
        <DataTemplate x:Key="CremationDateColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=CremationDate, Converter={StaticResource DateFormattingConverter}}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- burial date column -->
        <DataTemplate x:Key="BurialDateColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=BurialDate, Converter={StaticResource DateFormattingConverter}}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}" IsEnabled="{Binding Path=IsLiving, Converter={StaticResource NotConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- isLiving -->
        <DataTemplate x:Key="IsLivingColumnTemplate">
            <CheckBox Margin="10,0,0,0" x:Name="IsLivingEditCheckBox" VerticalAlignment="Center" Content="" Foreground="{DynamicResource InputFontColor}" Grid.Column="1" Grid.Row="1" IsEnabled="{Binding Path=IsLocked, Converter={StaticResource NotConverter}, Mode=Default}" IsChecked="{Binding Path=IsLiving, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, FallbackValue=True}"/>
        </DataTemplate>

        <!-- education place column -->
        <DataTemplate x:Key="EducationColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" AcceptsReturn="True" MaxHeight="22" ToolTip="{Binding Path=Education}" Text="{Binding Path=Education}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- religion column -->
        <DataTemplate x:Key="ReligionColumnTemplate">
            <TextBox Style="{StaticResource TextBoxStyle}" Text="{Binding Path=Religion}" IsReadOnly="{Binding Path=IsLocked, Converter={StaticResource BoolConverter}, Mode=Default}"/>
        </DataTemplate>

        <!-- ID column -->
        <DataTemplate x:Key="IDColumnTemplate">
            <TextBlock Style="{StaticResource AgeTextBlockStyle}" Text="{Binding Path=Id}"/>
        </DataTemplate>

        <!-- list view details -->

        <ControlTemplate x:Key="FamilyEditListViewItemTemplate" TargetType='{x:Type ListViewItem}'>
            <Grid SnapsToDevicePixels="True" Margin="0,3,0,0">
                <Border x:Name="Border" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="5,5,5,5"/>
                <GridViewRowPresenter TextBlock.Foreground="{TemplateBinding Foreground}" TextBlock.FontSize="11.5" Content="{TemplateBinding Content}" Columns="{TemplateBinding GridView.ColumnCollection}"/>
            </Grid>
            <ControlTemplate.Triggers>
                <!-- Change IsSelected SelectedListBoxBrush to set the selection color for the items -->
                <Trigger Property="IsSelected" Value="true">
                    <Setter Property="Background" Value="{DynamicResource FamilyEditListViewSelectedBrush}" TargetName="Border"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="false">
                    <Setter Property="Background" Value="{DynamicResource FamilyEditListViewSelectedBrush}" TargetName="Border"/>
                </Trigger>
            </ControlTemplate.Triggers>
        </ControlTemplate>

        <Style x:Key="FamilyEditListViewStyle" TargetType="{x:Type ListView}">
            <Setter Property="Margin" Value="0,2,0,0"/>
            <Setter Property="SnapsToDevicePixels" Value="True"/>
            <Setter Property="OverridesDefaultStyle" Value="True"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type ListView}">
                        <Border x:Name="Border">
                            <ScrollViewer Style="{DynamicResource {x:Static GridView.GridViewScrollViewerStyleKey}}">
                                <ItemsPresenter />
                            </ScrollViewer>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- style applied to column headers -->
        <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type Border}">
            <Setter Property="BorderBrush" Value="{DynamicResource HeaderBorderBrush}"/>
            <Setter Property="Background" Value="{DynamicResource HeaderBackgroundBrush}"/>
            <Setter Property="BorderThickness" Value="0,1,0,1"/>
        </Style>

        <!-- style applied to selected column headers -->
        <Style x:Key="ColumnSelectedHeaderStyle" BasedOn="{StaticResource ColumnHeaderStyle}"  TargetType="{x:Type Border}">
            <Setter Property="Background" Value="{DynamicResource SelectedHeaderBackgroundBrush}"/>
        </Style>

        <!-- style applied to column headers -->
        <Style x:Key="FirstColumnHeaderStyle" BasedOn="{StaticResource ColumnHeaderStyle}" TargetType="{x:Type Border}">
            <Setter Property="BorderThickness" Value="1,1,0,1"/>
            <Setter Property="Padding" Value="15,5,5,5"/>
            <Setter Property="CornerRadius" Value="5,0,0,5"/>
        </Style>

        <!-- style applied to column headers -->
        <Style x:Key="LastColumnHeaderStyle" BasedOn="{StaticResource ColumnHeaderStyle}" TargetType="{x:Type Border}">
            <Setter Property="BorderThickness" Value="0,1,1,1"/>
            <Setter Property="Padding" Value="0"/>
            <Setter Property="CornerRadius" Value="0,5,5,0"/>
        </Style>

        <!-- header used when no sorting -->
        <Style x:Key="FamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <TextBlock Text="{TemplateBinding ContentControl.Content}"
                  TextAlignment="Left" VerticalAlignment="Center" FontWeight="Bold" Margin="5,0,0,0"
                  Foreground="{DynamicResource FamilyDataGridHeaderFontColor}" />
                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}" />
              </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="PhotoFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}" MaxWidth="26">
                            <DockPanel>
                                <Image Source="..\..\Images\Photo.png" Height="12" Margin="3,0,0,0"/>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="RestrictionFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <Image Source="..\..\Images\SecurityLock.png" Height="12" Margin="3,0,0,0"/>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate x:Key="RestrictionFamilyDataGridColumnHeader">
            <Image Source="..\..\Images\SecurityLock.png" Height="12" Margin="3,0,0,0" />
        </DataTemplate>
        
        <DataTemplate x:Key="CitationFamilyDataGridColumnHeader">
            <Image Source="..\..\Images\Citation.png" Height="12" Margin="3,0,0,0" />
        </DataTemplate>
        
        <DataTemplate x:Key="PhotoFamilyDataGridColumnHeader">
            <Image Source="..\..\Images\Photo.png" Height="12" Margin="3,0,0,0" />
        </DataTemplate>

        <DataTemplate x:Key="NoteFamilyDataGridColumnHeader">
            <Image Source="..\..\Images\Note.png" Height="12" Margin="3,0,0,0"/>
        </DataTemplate>

        <DataTemplate x:Key="AttachmentFamilyDataGridColumnHeader">
            <Image Source="..\..\Images\Paperclip.png" Height="12" Margin="3,0,0,0"/>
        </DataTemplate>             

        <Style x:Key="CitationFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <Image Source="..\..\Images\Citation.png" Height="12" Margin="3,0,0,0"/>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="ImageFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="NoteFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <Image Source="..\..\Images\Note.png" Height="12" Margin="3,0,0,0"/>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="AttachmentFamilyDataGridViewColumnHeader" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnHeaderStyle}">
                            <DockPanel>
                                <Image Source="..\..\Images\Paperclip.png" Height="12" Margin="3,0,0,0"/>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}"/>
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>



        <!-- header used to sort ascending -->
        <Style x:Key="FamilyDataGridViewColumnHeaderAscending" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnSelectedHeaderStyle}">
                            <DockPanel>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                    <TextBlock Text="{TemplateBinding ContentControl.Content}" TextAlignment="Left"
                    VerticalAlignment="Center" FontWeight="Bold" Margin="5,0,0,0"
                    Foreground="{DynamicResource FamilyDataGridSelectedHeaderFontColor}" />
                  <Path StrokeThickness="1" Fill="{DynamicResource FamilyDataGridSelectedHeaderFontColor}" Data="M 5,10 L 15,10 L 10,5 L 5,10" />
                </StackPanel>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}" />
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <!-- header used to sort descending -->
        <Style x:Key="FamilyDataGridViewColumnHeaderDescending" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource ColumnSelectedHeaderStyle}">
                            <DockPanel>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                                    <TextBlock Text="{TemplateBinding ContentControl.Content}" TextAlignment="Left" 
                    VerticalAlignment="Center" FontWeight="Bold" Margin="5,0,0,0"
                    Foreground="{DynamicResource FamilyDataGridSelectedHeaderFontColor}" />
                  <Path StrokeThickness="1" Fill="{DynamicResource FamilyDataGridSelectedHeaderFontColor}" Data="M 5,5 L 10,10 L 15,5 L 5,5" />
                </StackPanel>
                                <Thumb x:Name="PART_HeaderGripper" Style="{StaticResource ColumnGrip}" />
                            </DockPanel>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="FirstColumnGridViewColumnHeader" BasedOn="{StaticResource FamilyDataGridViewColumnHeader}" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource FirstColumnHeaderStyle}">
                            <TextBlock
                Text="{TemplateBinding ContentControl.Content}"
                TextAlignment="Left"
                VerticalAlignment="Center"
                Foreground="{DynamicResource FamilyDataGridHeaderFontColor}"
                FontWeight="Bold"/>
            </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="LastColumnGridViewColumnHeader" BasedOn="{StaticResource FamilyDataGridViewColumnHeader}" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border x:Name="Bd" Style="{DynamicResource LastColumnHeaderStyle}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <Style x:Key="FamilyEditListViewItemStyle" TargetType="{x:Type ListViewItem}" >
            <Setter Property="Template" Value="{DynamicResource FamilyEditListViewItemTemplate}"/>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>

        </Style>

        <Style x:Key="StatisticsHeaderStyle" TargetType="{x:Type Border}">
            <Setter Property="Margin" Value="5,15,5,10"/>
            <Setter Property="Padding" Value="10,5,10,5"/>
            <Setter Property="Background" Value="{DynamicResource StatisticsHeaderBackgroundBrush}"/>
            <Setter Property="BorderThickness" Value="0,1,0,0" />
            <Setter Property="BorderBrush" Value="{DynamicResource StatisticsHeaderBorderBrush}" />
        </Style>

        <Style x:Key="StatisticsControlStyle" TargetType="{x:Type Border}">
            <Setter Property="Margin" Value="10,0,10,0"/>
            <Setter Property="Background" Value="{DynamicResource StatisticsControlBackgroundBrush}"/>
            <Setter Property="CornerRadius" Value="3,3,3,3"/>
        </Style>

    </UserControl.Resources>


    <!-- family data control -->
    <Border Margin="10,0,10,10" Style="{DynamicResource BorderStyle}" Background="{DynamicResource BackgroundBrush}">
        <DockPanel>

            <!-- header area -->
            <DockPanel Margin="10,0,10,0" DockPanel.Dock="Top" Height="30">
                <TextBlock Text="{x:Static properties:Resources.FamilyData}" Style="{DynamicResource HeaderStyle}" FontWeight="Bold" Margin="5,0,0,0" VerticalAlignment="Center" Foreground="{DynamicResource HeaderFontColor}"/>
            <Button Margin="0,0,3,0" Width="Auto" MinWidth="40" Content="{x:Static properties:Resources.Back}" Click="CloseButton_Click" Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Center" DockPanel.Dock="Right" Height="15" x:Name="CloseButton" FontSize="10"/>
            </DockPanel>

            <!-- filter, list and chart area -->
            <Border CornerRadius="0,0,10,10" BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,1,0,0" Background="{DynamicResource PanelGradientBrush}">
                <Grid DockPanel.Dock="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <!-- filter area -->
                    <Border Grid.Row="0" Grid.Column="0" Background="#90ffffff" Margin="5,5,0,5" Padding="6" CornerRadius="4">
                        <StackPanel Orientation="Horizontal" VerticalAlignment="Center">
                            <Label Foreground="#FF1F3066" Content="{x:Static properties:Resources.Filter}" Margin="0,-3,10,0"/>
                            <local:FilterText x:Name="FilterTextBox" TextBoxBase.TextChanged="FilterTextBox_TextChanged" ResetFilter="FilterTextBox_ResetFilter" Width="250" VerticalAlignment="Center" />
                            <Label Margin="10,-6,0,0" Foreground="#FFCCCCCC" FontSize="16" VerticalAlignment="Center"
              Content="{Binding Path=Items.Count, ElementName=FamilyEditor}"  />
                        </StackPanel>
                    </Border>

                    <!-- list area -->

                    <Border Grid.Row="2" Grid.Column="0" Margin="5,0,0,5">

                        <UniformGrid Columns="1">
                            <tk:DataGrid x:Name="FamilyEditorGrid"
                                     Background="{x:Null}"                                         
                                     Margin="-2,0,0,0"
                                     BorderBrush="{x:Null}"
                                     AutoGenerateColumns="False"
                                     SelectionMode="Single"
                                     GridLinesVisibility="None"
                                     LostFocus="FamilyEditor_LostFocus">
                                
                                <tk:DataGrid.CellStyle>
                                    <Style TargetType="{x:Type tk:DataGridCell}">
                                        <Setter Property="VerticalContentAlignment" Value="Center" />
                                    </Style>
                                </tk:DataGrid.CellStyle>
                                
                                <tk:DataGrid.RowStyle>
                                    <Style TargetType="{x:Type tk:DataGridRow}">
                                        <Setter Property="Height" Value="32" />
                                    </Style>
                                </tk:DataGrid.RowStyle>
                                

                                <tk:DataGrid.Columns>
                                    <tk:DataGridTemplateColumn HeaderTemplate="{StaticResource RestrictionFamilyDataGridColumnHeader}"
                                                               SortMemberPath="HasRestriction"
                                                               CellTemplate="{StaticResource RestrictionColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn HeaderTemplate="{StaticResource CitationFamilyDataGridColumnHeader}"
                                                               SortMemberPath="HasCitations"
                                                               CellTemplate="{StaticResource SourcesColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn HeaderTemplate="{StaticResource PhotoFamilyDataGridColumnHeader}"
                                                               SortMemberPath="HasPhoto"
                                                               CellTemplate="{StaticResource PhotosColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn HeaderTemplate="{StaticResource NoteFamilyDataGridColumnHeader}"
                                                               SortMemberPath="HasNote"                                                              
                                                               CellTemplate="{StaticResource NotesColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn HeaderTemplate="{StaticResource AttachmentFamilyDataGridColumnHeader}"
                                                               SortMemberPath="HasAttachment"
                                                               CellTemplate="{StaticResource AttachmentsColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn SortMemberPath="HasAvatar"
                                                               CellTemplate="{StaticResource ImagesColumnTemplate}" />
                                    
                                    <tk:DataGridTextColumn Header="{x:Static properties:Resources.Names}"
                                                           Binding="{Binding FirstName}"
                                                           SortMemberPath="FirstName" />
                                    
                                    <tk:DataGridTextColumn Header="{x:Static properties:Resources.Surname}"                                                           
                                                           Binding="{Binding LastName}"
                                                           SortMemberPath="LastName" />
                                    
                                    <tk:DataGridTextColumn Header="{x:Static properties:Resources.Suffix}"
                                                           Binding="{Binding Suffix}"
                                                           SortMemberPath="Suffix" />
                                    
                                    <tk:DataGridTextColumn Header="{x:Static properties:Resources.Age}"
                                                           Binding="{Binding Age}"
                                                           SortMemberPath="Age"
                                                           IsReadOnly="True" />
                                    
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.BirthDate}"
                                                               SortMemberPath="BirthDate"                                                               
                                                               CellTemplate="{StaticResource BirthDateColumnTemplate}" />
                                    
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.BirthPlace}"
                                                               SortMemberPath="BirthPlace" CellTemplate="{StaticResource BirthPlaceColumnTemplate}" />
                                                               
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.DeathDate}"
                                                               SortMemberPath="DeathDate"
                                                               CellTemplate="{StaticResource DeathDateColumnTemplate}" />
                                        
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.DeathPlace}" SortMemberPath="DeathPlace" CellTemplate="{StaticResource DeathPlaceColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.IsLivingQuestion}" SortMemberPath="IsLiving" CellTemplate="{StaticResource IsLivingColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.Occupation}" SortMemberPath="Occupation" CellTemplate="{StaticResource OccupationColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.Education}" SortMemberPath="Education" CellTemplate="{StaticResource EducationColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.Religion}" SortMemberPath="Religion" CellTemplate="{StaticResource ReligionColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.BurialPlace}" SortMemberPath="BurialPlace" CellTemplate="{StaticResource BurialPlaceColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.BurialDate}" SortMemberPath="BurialDate" CellTemplate="{StaticResource BurialDateColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.CremationPlace}" SortMemberPath="CremationPlace" CellTemplate="{StaticResource CremationPlaceColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.CremationDate}" SortMemberPath="CremationDate" CellTemplate="{StaticResource CremationDateColumnTemplate}" />
                                    <tk:DataGridTemplateColumn Header="{x:Static properties:Resources.ID}" SortMemberPath="ID" CellTemplate="{StaticResource IDColumnTemplate}" />
                                </tk:DataGrid.Columns>

                            </tk:DataGrid>

                            <local:FamilyEditListView x:Name="FamilyEditor" Background="{x:Null}" Margin="-2,0,0,0" BorderBrush="{x:Null}"
            ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto"
            VirtualizingStackPanel.IsVirtualizing="True" VirtualizingStackPanel.VirtualizationMode="Recycling" ScrollViewer.CanContentScroll="True"
            SelectionMode="Single" Style="{DynamicResource FamilyEditListViewStyle}"
            ItemContainerStyle="{DynamicResource FamilyEditListViewItemStyle}"
            LostFocus="FamilyEditor_LostFocus" d:IsHidden="True">
                                <local:FamilyEditListView.ContextMenu>
                                    <!--Columns in the details edit more panel are minimized by default along with most icon symbols-->
                                    <ContextMenu x:Name="ColumnMenu" Closed="UpdateColumnsVisible" StaysOpen="True" >
                                        <MenuItem Foreground="Black" x:Name="RestrictionMenu" Header="{x:Static properties:Resources.Restriction}" IsCheckable="True"/>
                                        <MenuItem Foreground="Black" x:Name="CitationMenu" Header="{x:Static properties:Resources.Citations}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="PhotosMenu" Header="{x:Static properties:Resources.Photos}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="NotesMenu" Header="{x:Static properties:Resources.Notes}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="AttachmentsMenu" Header="{x:Static properties:Resources.Attachments}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="ImagesMenu" Header="{x:Static properties:Resources.Image}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="NamesMenu" Header="{x:Static properties:Resources.Names}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="SurnameMenu" Header="{x:Static properties:Resources.Surname}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="SuffixMenu" Header="{x:Static properties:Resources.Suffix}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="AgeMenu" Header="{x:Static properties:Resources.Age}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="BirthDateMenu" Header="{x:Static properties:Resources.BirthDate}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="BirthPlaceMenu" Header="{x:Static properties:Resources.BirthPlace}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="DeathDateMenu" Header="{x:Static properties:Resources.DeathDate}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="DeathPlaceMenu" Header="{x:Static properties:Resources.DeathPlace}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="IsLivingMenu" Header="{x:Static properties:Resources.IsLivingQuestion}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="OccupationMenu" Header="{x:Static properties:Resources.Occupation}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="ReligionMenu" Header="{x:Static properties:Resources.Religion}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="EducationMenu" Header="{x:Static properties:Resources.Education}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="BurialPlaceMenu" Header="{x:Static properties:Resources.BurialPlace}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="BurialDateMenu" Header="{x:Static properties:Resources.BurialDate}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="CremationPlaceMenu" Header="{x:Static properties:Resources.CremationPlace}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="CremationDateMenu" Header="{x:Static properties:Resources.CremationDate}" IsCheckable="True" />
                                        <MenuItem Foreground="Black" x:Name="IDMenu" Header="{x:Static properties:Resources.ID}" IsCheckable="True" />
                                    </ContextMenu>
                                </local:FamilyEditListView.ContextMenu>
                                <local:FamilyEditListView.View>
                                    <GridView AllowsColumnReorder="True">

                                        <GridViewColumn Width="10"
                  HeaderContainerStyle="{DynamicResource FirstColumnGridViewColumnHeader}"
                  CellTemplate="{StaticResource EmptyColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Restriction" Header=""
                  SortProperty="HasRestriction" SortStyle="RestrictionFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource RestrictionFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource RestrictionColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Citation"    
                  SortProperty="HasCitations" SortStyle="CitationFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource CitationFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource SourcesColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Photo"  
                  SortProperty="HasPhoto" SortStyle="PhotoFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource PhotoFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource PhotosColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Note"    
                  SortProperty="HasNote" SortStyle="NoteFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource NoteFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource NotesColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Attachment"   
                  SortProperty="HasAttachment" SortStyle="AttachmentFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource AttachmentFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource AttachmentsColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Image"  
                  SortProperty="HasAvatar" SortStyle="ImageFamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource ImageFamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource ImagesColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Names" Header="{x:Static properties:Resources.Names}"
                  SortProperty="FirstName" SortStyle="FamilyDataGridViewColumnHeader"
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource NamesColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Surname" Header="{x:Static properties:Resources.Surname}" 
                  SortProperty="LastName" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource SurnameColumnTemplate}"/>

                                        <local:SortListViewColumn x:Name="Suffix" Header="{x:Static properties:Resources.Suffix}" 
                  SortProperty="Suffix" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource SuffixColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Age" Header="{x:Static properties:Resources.Age}" 
                  SortProperty="Age"  SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource AgeColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="BirthDate" Header="{x:Static properties:Resources.BirthDate}" 
                  SortProperty="BirthDate" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"                   
                  CellTemplate="{StaticResource BirthDateColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="BirthPlace" Header="{x:Static properties:Resources.BirthPlace}" 
                  SortProperty="BirthPlace" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource BirthPlaceColumnTemplate}" 
				  />


                                        <local:SortListViewColumn x:Name="DeathDate" Header="{x:Static properties:Resources.DeathDate}" 
                  SortProperty="DeathDate" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource DeathDateColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="DeathPlace" Header="{x:Static properties:Resources.DeathPlace}" 
                  SortProperty="DeathPlace" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource DeathPlaceColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="IsLiving" Header="{x:Static properties:Resources.IsLivingQuestion}" 
                  SortProperty="IsLiving" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource IsLivingColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Occupation" Header="{x:Static properties:Resources.Occupation}" 
                  SortProperty="Occupation"  SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource OccupationColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Education" Header="{x:Static properties:Resources.Education}" 
                  SortProperty="Education" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource EducationColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="Religion" Header="{x:Static properties:Resources.Religion}" 
                  SortProperty="Religion" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource ReligionColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="BurialPlace" Header="{x:Static properties:Resources.BurialPlace}" 
                  SortProperty="BurialPlace" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource BurialPlaceColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="BurialDate" Header="{x:Static properties:Resources.BurialDate}" 
                  SortProperty="BurialDate" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource BurialDateColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="CremationPlace" Header="{x:Static properties:Resources.CremationPlace}" 
                  SortProperty="CremationPlace" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource CremationPlaceColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="CremationDate" Header="{x:Static properties:Resources.CremationDate}" 
                  SortProperty="CremationDate" SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource CremationDateColumnTemplate}" />

                                        <local:SortListViewColumn x:Name="ID" Header="{x:Static properties:Resources.ID}" 
                  SortProperty="ID"  SortStyle="FamilyDataGridViewColumnHeader" 
                  HeaderContainerStyle="{DynamicResource FamilyDataGridViewColumnHeader}"
                  CellTemplate="{StaticResource IDColumnTemplate}" />

                                        <GridViewColumn Width="10"
                  HeaderContainerStyle="{DynamicResource LastColumnGridViewColumnHeader}"
                  CellTemplate="{StaticResource EmptyColumnTemplate}" />

                                    </GridView>
                                </local:FamilyEditListView.View>
                            </local:FamilyEditListView>

                        </UniformGrid>                        
                    </Border>

                    <!-- chart area -->
                    <Border Grid.Row="0" Grid.Column="1" Grid.RowSpan="3" Margin="5" 
          Style="{DynamicResource BorderStyle}" Background="{DynamicResource PanelGradientBrush}" Width="250">

                        <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                            <StackPanel>

                                <Label Margin="5,0,0,0" FontSize="18" FontWeight="Bold" Padding="8,8,5,2" Content="{x:Static properties:Resources.FamilyStatistics}"/>

                                <!-- tag cloud chart -->

                                <Border Style="{DynamicResource StatisticsHeaderStyle}">
                                    <TextBlock Text="{x:Static properties:Resources.Surnames}" Foreground="{DynamicResource FontColor}"/>
                                </Border>
                                <Border Style="{DynamicResource StatisticsControlStyle}">
                                    <local:TagCloud x:Name="TagCloudControl" Padding="5,0,5,0"
                                ListBorderBrush="{DynamicResource SolidBorderBrush}"
                                SelectedBrush="{DynamicResource FamilyEditListViewSelectedBrush}"
                                DisabledForegroundBrush="{DynamicResource DisabledForegroundBrush}"
                                Foreground="{DynamicResource FontColor}"
                                TagSelectionChanged="TagCloudControl_TagSelectionChanged" MaxHeight="115"/>
                                </Border>

                                <!-- age chart -->
                                <Border  Style="{DynamicResource StatisticsHeaderStyle}" >
                                    <TextBlock Text="{x:Static properties:Resources.AgeDistributions}" Foreground="{DynamicResource FontColor}"/>
                                </Border>
                                <Border Style="{DynamicResource StatisticsControlStyle}">
                                    <local:Histogram x:Name="AgeDistributionControl"
				                Foreground="{DynamicResource FontColor}"
				                CategoryStroke="{DynamicResource CategoryStrokeBrush}"
				                CategoryFill="{DynamicResource CategoryFillBrush}"
				                SelectedBrush="{DynamicResource FamilyEditListViewSelectedBrush}"
				                DisabledForegroundBrush="{DynamicResource DisabledForegroundBrush}"
				                AxisBrush="{DynamicResource AxisBrush}" 
                                CategorySelectionChanged="AgeDistributionControl_CategorySelectionChanged" MaxHeight="115" />
                                </Border>

                                <!-- birthdays chart -->
                                <Border Style="{DynamicResource StatisticsHeaderStyle}">
                                    <TextBlock Text="{x:Static properties:Resources.Birthdays}" Foreground="{DynamicResource FontColor}"/>
                                </Border>
                                <Border Style="{DynamicResource StatisticsControlStyle}" MaxHeight="115" >
                                    <local:SharedBirthdays x:Name="BirthdaysControl"
                                SharedBirthdaysSelectionChanged="BirthdaysControl_SelectionChanged" />
                                </Border>

                                <!-- gender chart -->
                                <Border Style="{DynamicResource StatisticsHeaderStyle}">
                                    <TextBlock Text="{x:Static properties:Resources.GenderDistributions}" Foreground="{DynamicResource FontColor}"/>
                                 </Border>

                                <Border Style="{DynamicResource StatisticsControlStyle}" MaxHeight="115" >
                                    <local:Histogram x:Name="GenderDistributionControl1"
				                    Foreground="{DynamicResource FontColor}"
				                    CategoryStroke="{DynamicResource CategoryStrokeBrush}"
				                    CategoryFill="{DynamicResource CategoryFillBrush}"
				                    SelectedBrush="{DynamicResource FamilyEditListViewSelectedBrush}"
				                    DisabledForegroundBrush="{DynamicResource DisabledForegroundBrush}"
				                    AxisBrush="{DynamicResource AxisBrush}" 
                                    CategorySelectionChanged="GenderDistributionControl1_CategorySelectionChanged" MaxHeight="115" />
                                </Border>

                                <!-- living chart -->
                                <Border Style="{DynamicResource StatisticsHeaderStyle}">
                                    <TextBlock Text="{x:Static properties:Resources.LivingStatus}" Foreground="{DynamicResource FontColor}"/>
                                 </Border>
                                <Border Style="{DynamicResource StatisticsControlStyle}" MaxHeight="115" >
                                    <local:Histogram x:Name="LivingDistributionControl1"
				                    Foreground="{DynamicResource FontColor}"
				                    CategoryStroke="{DynamicResource CategoryStrokeBrush}"
				                    CategoryFill="{DynamicResource CategoryFillBrush}"
				                    SelectedBrush="{DynamicResource FamilyEditListViewSelectedBrush}"
				                    DisabledForegroundBrush="{DynamicResource DisabledForegroundBrush}"
				                    AxisBrush="{DynamicResource AxisBrush}" 
                                    CategorySelectionChanged="LivingDistributionControl1_CategorySelectionChanged" MaxHeight="115" />
                                </Border>
                            </StackPanel>
                        </ScrollViewer>
                    </Border>

                </Grid>
            </Border>

        </DockPanel>
    </Border>

</UserControl>
